package com.jdbc;

import java.sql.*;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class DemoJdbc {
    public static void main(String[] args) throws Exception {

//1.导入驱动架包

//2.注册驱动

        Class.forName("com.mysql.jdbc.Driver");

//3.获取数据库连接对象

        Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.4.200:3306/vhr?useSSL=false", "root", "qwer123");

//4.定义sql语句

        String sql = "update role set name='何其' where id=2";

//5.获取执行sql的对象 Statement

        Statement stmt = conn.createStatement();

//6.执行sql

        long count = stmt.executeLargeUpdate(sql);

//7.处理结果

        System.out.println(count);

//8.释放资源

        stmt.close();

        conn.close();

    }

}
